package com.easy.work.function.me;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.easy.work.R;
import com.easy.work.app.BaseActivity;
import com.easy.work.bean.MsgDetailBean;
import com.easy.work.db.DataProvider;
import com.easy.work.db.MessageBean;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MsgDetailActivity extends BaseActivity {

    private static final String MSG_TYPE = "MSG_TYPE";

    public static void start(Context ctx, MessageBean bean) {
        Intent intent = new Intent(ctx, MsgDetailActivity.class);
        intent.putExtra(MSG_TYPE, bean);
        ctx.startActivity(intent);
    }

    @BindView(R.id.tv_first)
    TextView tvFirst;
    @BindView(R.id.tv_first_content)
    TextView tvFirstContent;
    @BindView(R.id.tv_second)
    TextView tvSecond;
    @BindView(R.id.tv_second_content)
    TextView tvSecondContent;
    @BindView(R.id.tv_third)
    TextView tvThird;
    @BindView(R.id.tv_third_content)
    TextView tvThirdContent;
    @BindView(R.id.tv_fourth_content)
    TextView tvFourthContent;
    @BindView(R.id.tv_fifth_content)
    TextView tvFifthContent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_msg_detail);
        ButterKnife.bind(this);
        // 0 面试消息  1 录用消息
        MessageBean msgBean = (MessageBean) getIntent().getSerializableExtra(MSG_TYPE);
        MsgDetailBean bean = new MsgDetailBean(msgBean);
        initTitle(bean.title);
        tvFirst.setText(bean.first);
        tvFirstContent.setText(bean.firstContent);
        tvSecond.setText(bean.second);
        tvSecondContent.setText(bean.secondContent);
        tvThird.setText(bean.third);
        tvThirdContent.setText(bean.thirdContent);
        tvFourthContent.setText(bean.fourthContent);
        tvFifthContent.setText(bean.fifthContent);
        DataProvider.updateReadState(this, msgBean);
    }
}
